<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    protected $table = 'article';

    protected $fillable = ['title', 'description','content','author','is_admin','status','type','pic','post_lock','visit_cnt','publisher_id'];

    //public $timestamps= false;

    public function articletag(){
        return $this->belongsToMany(Tag::class,"article_tag","article_id","tag_id");
    }

    public function firstPic(){
        return $this->hasOne(Pic::class,"id","pic")->select("id","related_id","path");
    }

    public function morePic(){
        return $this->hasMany(Pic::class,"related_id","id")->select("id","related_id","path");
    }

    public function scopeTags(){

    }
}
